<!DOCTYPE html>
<html>
    <head>
        <title>Preview Display</title>
        <meta charset="UTF-8">
        <link rel="shortcut icon" href="custom/images/favicon.ico?v=2" />
        <style>
            html, body {
                padding: 0px;
                margin: 0px;
            }
        </style>

        <script src='custom/libs/echarts.js'></script>
        <script src='custom/configs/htconfig.js'></script>
        <script src='libs/ht.js'></script>
        <script src='libs/ht-obj.js'></script>

        <script>
            function init() {
                dataModel = new ht.DataModel();
                graphView = new ht.graph.GraphView(dataModel);
                graphView.addToDOM();

                ht.Default.xhrLoad('previews/display.json', function(text) {
                    var json = ht.Default.parse(text);
                    if(json.title) document.title = json.title;
                    dataModel.deserialize(json);
                    graphView.fitContent(true);

                    var lineData1 = [120, 132, 101, 134, 90, 230, 210, 399, 499, 599];
                    var lineData2 = [220, 182, 191, 234, 290, 330, 310, 200, 540, 100];
                    var xAxisData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
                    var chart2 = dataModel.getDataByTag('chart2');
                    chart2.a({
                        lineData1: lineData1,
                        lineData2: lineData2,
                        xAxisData: xAxisData
                    })
                    var count = xAxisData.length;
                    setInterval(function () {
                        lineData1.shift();
                        lineData1.push(Math.floor(Math.random() * 600));
                        lineData2.shift();
                        lineData2.push(Math.floor(Math.random() * 600));
                        xAxisData.shift();
                        xAxisData.push(++count);
                        chart2.iv();
                    }, 1200);

                });
            }

        </script>
    </head>
    <body onload='setTimeout(init, 300)'>
    </body>
</html>
